A=[4 -7 3 7 5; 6 -8 5 12 -8; -7 10 -8 -9 14; 3 -5 4 2 -6; -5 6 -6 -7 3]
A(2,:)=A(2,:)-A(2,1)/A(1,1)*A(1,:);
A(3,:)=A(3,:)-A(3,1)/A(1,1)*A(1,:);
A(4,:)=A(4,:)-A(4,1)/A(1,1)*A(1,:);
A(5,:)=A(5,:)-A(5,1)/A(1,1)*A(1,:);
A(3,:)=A(3,:)-A(3,2)/A(2,2)*A(2,:);
A(4,:)=A(4,:)-A(4,2)/A(2,2)*A(2,:);
A(5,:)=A(5,:)-A(5,2)/A(2,2)*A(2,:);
A(4,:)=A(4,:)-A(4,3)/A(3,3)*A(3,:);
A(5,:)=A(5,:)-A(5,3)/A(3,3)*A(3,:);
A(1,:)=A(1,:)-A(1,2)/A(2,2)*A(2,:);
A(2,:)=A(2,:)-A(2,3)/A(3,3)*A(3,:);
A(1,:)=A(1,:)-A(1,3)/A(3,3)*A(3,:);
A(1,:)=A(1,:)/A(1,1);
A(2,:)=A(2,:)/A(2,2);
A(3,:)=A(3,:)/A(3,3);
A(4,:)=A(4,:)/A(4,5);
A(5,:)=A(5,:)-A(5,5)/A(4,5)*A(4,:);
A(1,:)=A(1,:)-A(1,5)/A(4,5)*A(4,:);
A(2,:)=A(2,:)-A(2,5)/A(4,5)*A(4,:);
A(3,:)=A(3,:)-A(3,5)/A(4,5)*A(4,:);

A

